package com.dd.ms.auth.controller;

import com.dd.ms.auth.pojo.req.UserRolesBatchAddReq;
import com.dd.ms.auth.service.impl.UserRolesRelServiceImpl;
import com.dd.ms.common.response.ApiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author liuxianmeng
 * @CreateTime 2025/7/9 16:05
 * @Description 用户 & 角色 关联操作
 */
@RestController
@RequestMapping("/user-roles")
@RequiredArgsConstructor
@Api(tags = "用户 & 角色 关联操作")
public class UserRolesRelController {

    private final UserRolesRelServiceImpl userRolesRelService;

    @ApiOperation("批量添加用户角色")
    @PostMapping("/add/batch")
    public ApiResponse<Void> batchAdd(@ApiParam("角色权限批量关联信息") @RequestBody UserRolesBatchAddReq req) {
        userRolesRelService.batchAddUserRolesRel(req);
        return ApiResponse.success();
    }
}
